var ACTION = require("../base/action");
var utils = require("../newUtils/utils");

var actionWatch = new ACTION("看直播");

actionWatch.goStart = function () {
  utils.clickPoint.apply(
    utils,
    utils.getSizePoint([41, 453, 529, 819], 1080, 2340)
  );
};
actionWatch.exec = function (count) {
  var logger = utils.createLogger(this.name);
  var total = 0;
  for (var index = 0; index < count; index++) {
    var watchSpan = utils.getRandom(30, 60);
    logger("第-" + (index + 1) + "-次看直播，预计-" + watchSpan + "-秒");
    sleep(watchSpan * 1000);
    total = total + watchSpan;
  }
  return total;
};
actionWatch.run = function () {
  this.goStart();
  this.beforeExec();
  this.exec(2);
  this.afterExec();
  this.beforeEnd();
  this.end();
  this.afterEnd();
};

module.exports = actionWatch;
